package com.yanlin.servicedriveruser.generator;

import com.baomidou.mybatisplus.generator.FastAutoGenerator;
import com.baomidou.mybatisplus.generator.config.OutputFile;
import com.baomidou.mybatisplus.generator.engine.FreemarkerTemplateEngine;

import java.util.Collections;

/**
 * <p>标题：MybatisPlusGenerator</p>
 * <p>功能：mysql 表-》 代码生成器
 * </p>
 * <p>
 * 其他说明：
 * </p>
 * <p>审核：</p>
 * <p>重构：</p>
 * <p>创建日期：2025-06-13 17:28</p>
 *
 * @author yanlin
 */
public class MybatisPlusGenerator {

    public static void main(String[] args) {

        FastAutoGenerator.create(
                "jdbc:mysql://127.0.0.1:3306/service-driver-user?characterEncoding=utf-8&serverTimezone=GMT%2B8",
                "root",
                "admin1234")
                .globalConfig(builder -> {
                    builder.author("yanlin")
                            .fileOverride()
                            .outputDir("/Users/bubble/Environment/Workspace/online-taxi-public/service-driver-user/src/main/java");
                })
                .packageConfig(builder -> {
                    builder.entity("dto")
                            .parent("com.yanlin.servicedriveruser")
                            .pathInfo(Collections.singletonMap(OutputFile.mapperXml, "/Users/bubble/Environment/Workspace/online-taxi-public/service-driver-user/src/main/java/com/yanlin/servicedriveruser/mapper"));
                })
                .strategyConfig(builder -> {
                    builder.addInclude("driver_car_binding_relationship");

                })
                .templateEngine(new FreemarkerTemplateEngine())
                .execute();
    }
}